package com.qf.openapi.web.master.controller;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping("/test")
public class TestController {

    /**
     * 测试返回页面
     * @return
     */
    @RequestMapping("/test1")
    public String test1(){
        System.out.println("test test1");
        return "/test.html";
    }

    /**
     * 测试返回json数据
     * @return
     */
    @RequestMapping("/test2")
    @ResponseBody  // 让当前的接口返回数据，而不是页面
    public Map<String,String> test2(){
        System.out.println("test test2");

        final HashMap<String, String> map = new HashMap<>();
        map.put("code","1");
        map.put("msg","ok");

        return map;

    }

}
